/*
 * @Author: zhuxiaoyi
 * @Date: 2021-10-28 12:40:36
 * @LastEditor: zhuxiaoyi
 * @LastEditTime: 2023-08-11 17:05:37
 * @Description:
 */
import service from "@/utils/request";
import BASE_URL from "./baseUrl";
// const BASE_URL = "/zyjy-knowleges-api";
export default {
  login: {
    loginSystemURL: "/login",
    loginSystem: function (
      params: object,
      successCallBack: Function,
      errorCallBack: Function
    ) {
      service.postQuery(
        BASE_URL + this.loginSystemURL,
        params,
        successCallBack,
        errorCallBack
      );
    },
  },
  taskInfo: {
    getTaskInfoListURL: "/taskInfo/list",
    getTaskInfoList: function (
      params: object,
      successCallBack: Function,
      errorCallBack: Function
    ) {
      service.postJson(
        BASE_URL + this.getTaskInfoListURL,
        params,
        successCallBack,
        errorCallBack
      );
    },
    addTaskInfoURL: "/taskInfo/add",
    addTaskInfo: function (
      params: object,
      successCallBack: Function,
      errorCallBack: Function
    ) {
      service.postJson(
        BASE_URL + this.addTaskInfoURL,
        params,
        successCallBack,
        errorCallBack
      );
    },
    editTaskInfoURL: "/taskInfo/update",
    editTaskInfo: function (
      params: any,
      successCallBack: Function,
      errorCallBack: Function
    ) {
      service.postJson(
        BASE_URL + this.editTaskInfoURL + "?id=" + params.id,
        params,
        successCallBack,
        errorCallBack
      );
    },
    changeTaskStatusURL: "/taskInfo/changeStatus",
    changeTaskStatus: function (
      params: any,
      successCallBack: Function,
      errorCallBack: Function
    ) {
      service.putJson(
        BASE_URL + this.changeTaskStatusURL + "?id=" + params.id,
        params.status,
        successCallBack,
        errorCallBack
      );
    },
    deleteTaskURL: "/taskInfo/delete",
    deleteTask: function (
      params: any,
      successCallBack: Function,
      errorCallBack: Function
    ) {
      service.deleteJson(
        BASE_URL + this.deleteTaskURL + "?id=" + params.id,
        params.status,
        successCallBack,
        errorCallBack
      );
    },
  },
  fileTask: {
    getTaskListURL: "/taskPublishManage/list",
    getTaskList: function (
      params: any,
      successCallBack: Function,
      errorCallBack: Function
    ) {
      service.postJson(
        BASE_URL + this.getTaskListURL,
        params,
        successCallBack,
        errorCallBack
      );
    },
    publishProductURL: "/taskPublishManage/publish",
    publishProduct: function (
      params: any,
      successCallBack: Function,
      errorCallBack: Function
    ) {
      service.postJson(
        BASE_URL + this.publishProductURL + "?tid=" + params.tid,
        params,
        successCallBack,
        errorCallBack
      );
    },
    editProductURL:"/taskPublishManage/editProject",
    editProduct: function (
      params: any,
      successCallBack: Function,
      errorCallBack: Function
    ) {
      service.putJson(
        BASE_URL + this.editProductURL+ "?tid=" + params.tid,
        params,
        successCallBack,
        errorCallBack
      );
    },
  },
  result: {
    getTasksListURL: "/datas/tasks",
    getTasksList: function (
      params: any,
      successCallBack: Function,
      errorCallBack: Function
    ) {
      service.get(
        BASE_URL + this.getTasksListURL,
        params,
        successCallBack,
        errorCallBack
      );
    },
    getResultListURL: "/datas/list",
    getResultList: function (
      params: any,
      successCallBack: Function,
      errorCallBack: Function
    ) {
      service.postJson(
        BASE_URL + this.getResultListURL,
        params,
        successCallBack,
        errorCallBack
      );
    },
    getChangeMapURL: "/datas/changepoly/info",
    getChangeMap: function (
      params: any,
      successCallBack: Function,
      errorCallBack: Function
    ) {
      service.postQuery(
        BASE_URL + this.getChangeMapURL,
        params,
        successCallBack,
        errorCallBack
      );
    },
  },
  user: {
    getUserInformationURL: "/open/api/users/",
    getUserInformation: function (
      params: any,
      successCallBack: Function,
      errorCallBack: Function
    ) {
      service.postQuery(
        BASE_URL + this.getUserInformationURL + params.id,
        params,
        successCallBack,
        errorCallBack
      );
    },
    getAllUsersURL:'/open/api/allUsers',
    getAllUsers: function (
      params: any,
      successCallBack: Function,
      errorCallBack: Function
    ) {
      service.get(
        BASE_URL + this.getAllUsersURL ,
        params,
        successCallBack,
        errorCallBack
      );
    },
  },
};
